package com.example.mapper;

import com.example.entity.FriendList;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 操作friend_list相关数据接口
*/
public interface FriendListMapper {

    /**
      * 新增
    */
    int insert(FriendList friendList);

    /**
      * 删除
    */
    int deleteById(Integer id);

    /**
      * 修改
    */
    int updateById(FriendList friendList);

    @Update("UPDATE friend_list SET is_show_public_key = #{isShowPublicKey} WHERE friend_id = #{userId} AND user_id = #{friendId}")
    int showPk(FriendList friendList);

    /**
      * 根据ID查询
    */
    FriendList selectById(Integer id);

    /**
      * 查询所有
    */
    List<FriendList> selectAll(FriendList friendList);

    @Select("select * from friend_list where user_id = #{id}")
    List<FriendList> selectByUserId(Integer id);

    @Select("select * from friend_list where friend_id = #{id}")
    List<FriendList> selectByFriendId(Integer id);
}